import React, { Component } from 'react';
import {
    StyleSheet,
    View,
    Text,
    Image,
    TouchableOpacity,
    Dimensions,
    ScrollView, StatusBar
} from 'react-native';
import { WebView } from 'react-native-webview'

import app from '../../../app.json';
// 取得屏幕的宽高Dimensions
const { width, height } = Dimensions.get('window');


export default class Live extends Component {
    constructor(props) {
        super(props);
        this.state = {
            detail:null,
        };
    }
    static navigationOptions = {
        title: '比分直播',
        //header: null,  //隐藏顶部导航栏
        //tabBarVisible: false, // 隐藏底部导航栏
        headerStyle: {
            backgroundColor: '#d0162e',
            paddingTop: 18,
        },
        headerTintColor: '#fff',
        headerTitleStyle: {

        },
    }
    onShouldStartLoadWithRequest = (event) => {
        if(event.url.indexOf('https://m.fox008.com/analysis/tips/')==-1){
            console.log(event.url);
            return true;
        }
        return false;
    };

    render() {
        //const js = `document.querySelector("#div_menu1").innerHTML = ""`;
        return (
            <View style={styles.container}>
                <StatusBar translucent={ true } backgroundColor="transparent" />

                <WebView
                    onShouldStartLoadWithRequest={this.onShouldStartLoadWithRequest}
                    source={{ uri: app.live_url }}
                    //injectedJavaScript={js}
                    style={{width:width,height:height,marginTop:-45}}
                />

            </View>
        );
    }
}
const styles = StyleSheet.create({
    container: {
        flex: 1,
        alignItems: 'center',
        backgroundColor: '#fff',
    },
});